// ConfigMgrLogFile.h
// 
// Copyright (c) Jason Sandys, 2009
//
// License: This code is released according to the 
// Microsoft Public License (Ms-PL) as documented at 
// http://osdappchooser.codeplex.com/license
//
//////////////////////////////////////////////////////////////////////

#pragma once

//************************************************************
/**
<summary>Specializes the CStdioFile class to create a
ConfigMgr specific log file</summary>
*/
//************************************************************
class CjConfigMgrLogFile : protected CStdioFile
{
public:
	CjConfigMgrLogFile(LPCTSTR lpszComponent = 0, LPCTSTR lpszLocation = 0);
	~CjConfigMgrLogFile(void);

	enum MsgType { Info = 1, Warning, Error };

	void LogMsg (CjConfigMgrLogFile::MsgType type, long nThreadID, LPCTSTR lpszFile, int nLineNum, DWORD dwStrID, ...);
	void LogMsg (CjConfigMgrLogFile::MsgType type, long nThreadID, LPCTSTR lpszFile, int nLineNum, LPCTSTR lpszMsg);
	void OpenLog (LPCTSTR lpszLocation = 0);

protected:
	///<summary>The name of the component to write to the log</summary>
	CString m_strComponent;
	///<summary>Sentinel to indicate if the file is open or not</summary>
	bool m_bFileOpen;
	///<summary>The timezone offset from UTC in minutes</summary>
	long m_tzOffset;

	//void WriteMsg (CjConfigMgrLogFile::MsgType type, long nThreadID, LPCTSTR lpszFile, int nLineNum, LPCTSTR lpszMsg);
};
